<?php
declare (strict_types = 1);

namespace app\admin\controller\v1\pageConfig;

use app\common\Backend;
use app\common\model\DeviceType;
use app\common\model\Navigation;
use app\common\model\ProductType;
use general\Tree;
use think\Request;

class DeviceTypeCon extends Backend
{
   
     /**
     * @var Navigation
     */
    protected $model = null;

    protected $quickSearchField = ['title'];

    /**
     * 远程select初始化传值
     * @var array
     */
    protected $initValue;
    protected $tree = null;
    /**
     * 搜索关键词
     * @var array|string
     */
    protected $keyword = false;

    /**
     * 是否组装Tree
     * @var bool
     */
    protected $assembleTree;

    protected $modelValidate = false;

    public function initialize()
    {
        parent::initialize();
        $this->model = new DeviceType();

       
        $this->initValue = $this->request->get("initValue/a", '');
        $this->keyword   = $this->request->request("quick_search");
    }

     /**
     * 数据源
     * @throws Throwable
     */
    public function index(): void
    {
        if ($this->request->param('select')) {
            $this->select();
        }

        list($where, $alias, $limit, $order) = $this->queryBuilder();
        $res = $this->model
            ->withJoin($this->withJoinTable, $this->withJoinType)
            ->alias($alias)
            ->where($where)
            ->order($order)
            ->paginate($limit);

        $this->success('', [
            'list'   => $res->items(),
            'total'  => $res->total(),
            'remark' => '',
        ]);
    }



    
}
